﻿namespace HiMap.Carto
{
    using System;
    using System.Text;

    public abstract class LayerClass : ILayer
    {
        protected IClass m_class;

        protected LayerClass()
        {
        }

        string ILayer.Caption
        {
            get
            {
                StringBuilder builder = new StringBuilder(0xff);
                VC.KWG_LAYER_GET_CAPTION(this.m_class.InPtr, builder);
                return builder.ToString();
            }
            set
            {
                VC.KWG_LAYER_SET_CAPTION(this.m_class.InPtr, new StringBuilder(value));
            }
        }

        IClass ILayer.Class
        {
            get
            {
                return this.m_class;
            }
            set
            {
                this.m_class = value;
            }
        }

        Map ILayer.Map
        {
            get
            {
                return new Map(VC.KWG_LAYER_GET_MAP(this.m_class.InPtr), true);
            }
        }

        double ILayer.MaxVisibleScale
        {
            get
            {
                double scale = 0;
                VC.KWG_LAYER_GET_MAXSCALE(this.m_class.InPtr, ref scale);
                return scale;
            }
            set
            {
                VC.KWG_LAYER_SET_MAXSCALE(this.m_class.InPtr, value);
            }
        }

        double ILayer.MinVisibleScale
        {
            get
            {
                double scale = 0;
                VC.KWG_LAYER_GET_MINSCALE(this.m_class.InPtr, ref scale);
                return scale;
            }
            set
            {
                VC.KWG_LAYER_SET_MINSCALE(this.m_class.InPtr, value);
            }
        }

        string ILayer.Name
        {
            get
            {
                StringBuilder builder = new StringBuilder(0xff);
                VC.KWG_LAYER_GET_NAME(this.m_class.InPtr, builder);
                return builder.ToString();
            }
        }

        LayerType ILayer.Type
        {
            get
            {
                return VC.KWG_LAYER_GET_TYPE(this.m_class.InPtr);
            }
        }

        bool ILayer.Visible
        {
            get
            {
                return VC.KWG_LAYER_GET_VISIBLE(this.m_class.InPtr);
            }
            set
            {
                VC.KWG_LAYER_SET_VISIBLE(this.m_class.InPtr, value);
            }
        }
    }
}

